﻿using shenghua.Authorization.Verification.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace shenghua.Authorization.Verification
{
    public class VerificationAppService: shenghuaAppServiceBase, IVerificationAppService
    {
        private readonly VerificationManager _verificationManager;

        public VerificationAppService(
            VerificationManager verificationManager
            )
        {
            _verificationManager = verificationManager;
        }

        public async Task SendPhoneCaptcha(PhoneNumberDto input)
        {
            await _verificationManager.SendPhoneCaptcha(input.PhoneNumber);
        }

        public async Task<bool> CheckPhoneNumber(PhoneNumberDto input)
        {
            return await _verificationManager.CheckPhoneNumber(input.PhoneNumber);
        }

        public async Task<bool> CheckPhoneCaptcha(CheckPhoneCaptchaDto input)
        {
            return await _verificationManager.CheckPhoneCaptcha(input.PhoneNumber, input.Captcha);
        }

        public async Task ResetPasswordByPhone(ResetPasswordByPhoneDto input)
        {
            await _verificationManager.ResetPasswordByPhone(input.PhoneNumber, input.Captcha, input.NewPassword);
        }
    }
}
